import 'dart:io';

void main() {
//  printWithDelay("111");
  createDescriptions(["aa", 'bb']);
}

Future<Null> printWithDelay(String message) async {
  await new Future.delayed(const Duration(seconds: 1));
  print(message);
}

Future<Null> createDescriptions(Iterable<String> objects) async {
  for (var object in objects) {
    try {
      var file = new File('$object.txt');
      if (await file.exists()) {
        var modified = await file.lastModified();
        print('File for $object already exists. It was modified on $modified.');
        continue;
      }
      await file.create();
      await file.writeAsString('Start describing $object in this file.');
    } on IOException catch (e) {
      print('Cannot create description for $object: $e');
    }
  }
}
